#include<iostream>
using namespace std;
const int N = 1e5 + 10;
int tree[N];
int n, m;
int lowbit(int x)
{
	return x & (-x);
}
void add(int x, int v)
{
	for (int i = x; i <= n; i += lowbit(i)) {
		tree[i] += v;
	}
}
int sum(int x)
{
	int ans = 0;
	for (int i = x; i; i -= lowbit(i)) {
		ans += tree[i];
	}
	return ans & 1 ? 1 : 0;
}
int main()
{
	cin >> n >> m;
	while (m--) {
		int op, l, r;
		cin >> op;
		if (op == 1) {
			cin >> l >> r;
			add(l, 1);
			add(r + 1, -1);
		}
		else {
			cin >> l;
			cout << sum(l) << endl;
		}
	}
	return 0;
}